package com.googlecode.imanager.client.event;

import com.googlecode.imanager.client.Control;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class MouseEvent extends InputEvent {

    private int x;
    private int y;
    private int clickCount;
    private MouseEventType eventType;
    // TODO MouseButton button;
    
    public MouseEvent(Control target, int x, int y, int clickCount, MouseEventType eventType) {
        super(target);
        setX(x);
        setY(y);
        setClickCount(clickCount);
        setEventType(eventType);
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getClickCount() {
        return clickCount;
    }

    public void setClickCount(int clickCount) {
        if (clickCount < 0){
            throw new IllegalArgumentException("clickCount");
        }
        this.clickCount = clickCount;
    }

    protected void setEventType(MouseEventType eventType) {
        if (eventType == null){
            throw new IllegalArgumentException("eventType");
        }
        this.eventType = eventType;
    }

    @Override
    public MouseEventType getEventType() {
        return eventType;
    }

}
